﻿using System;
using System.ComponentModel;
using System.Configuration;
using System.Drawing.Design;
using mki.Backup.Objects.Converters;
using mki.Backup.Objects.Editors;

namespace mki.Backup.Objects
{
	public class FTPDeleteElement : CustomConfigurationElement
	{
		#region Properties (4)

		// Public Properties (4) 

		/// <summary>
		/// Gets or sets the name.
		/// </summary>
		/// <value>
		/// The name.
		/// </value>
		[ConfigurationProperty("name", IsRequired = true, IsKey = true)]
		[Description("Name of the element"), Category("Design")]
		public new String Name
		{
			get { return base["name"].ToString(); }
			set
			{
				base["name"] = value;
				base.OnPropertyChanged("Name");
			}
		}

		/// <summary>
		/// Gets or sets the older than X days.
		/// </summary>
		/// <value>
		/// The older than X days.
		/// </value>
		[ConfigurationProperty("olderThanXDays", IsRequired = false)]
		[Description("Delete files older than the given value")]
		public Int32 OlderThanXDays
		{
			get { return Int32.Parse(this["olderThanXDays"].ToString()); }
			set { this["olderThanXDays"] = value; }
		}

		/// <summary>
		/// Gets or sets the search pattern.
		/// </summary>
		/// <value>
		/// The search pattern.
		/// </value>
		[ConfigurationProperty("searchPattern", IsRequired = false)]
		[Description("Search pattern for files. ServerName-Token is supported here")]
		public String SearchPattern
		{
			get { return this["searchPattern"].ToString(); }
			set { this["searchPattern"] = value; }
		}

		/// <summary>
		/// Gets or sets the target.
		/// </summary>
		/// <value>
		/// The target.
		/// </value>
		[ConfigurationProperty("targetFileName", IsRequired = false)]
		[Description("Specific file to delete.")]
		[Editor(typeof(FileNameUITypeEditor), typeof(UITypeEditor)), TypeConverter(typeof(ReadOnlyStringConverter))]
		public String TargetFileName
		{
			get { return this["targetFileName"].ToString(); }
			set { this["targetFileName"] = value; }
		}

		#endregion Properties
	}
}